package hc.bre.script

import hc.bre.cmn.RuleScriptBuilder

@groovy.transform.CompileStatic
class ClosureBuilder extends RuleScriptBuilder<ClosureDefinition> {
	@Override
	public void buildClassRuleBodyCore() {

		ruleDef.imports?.each { it ->
			if(!it.code) return;
			classUse(Class.forName(it.code));
		}

		apdNl("${result}.ret = ({");
		indentInc().apdNlBlock(ruleDef.script).indentDec();
		apdNl("}).call();")
	}
}
